<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>MyIsern - Select Collaboration</title>
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="cache-control" content="no-cache">
  </head>
<body>
MyIsern 2.0
  <table border="0">
  <tr valign="center">
    <td width="10"></td>
    <td align="center">
       <stripes:link href="/index.jsp">
         Home
       </stripes:link>
    </td>
    <td width="10"></td>
    <td align="center">
       <stripes:link href="/selectResearcher.jsp" id="SelectResearcherLink">
         Researchers
       </stripes:link>
    </td>
    <td width="10"></td>
    <td align="center">
       <stripes:link href="/selectOrganization.jsp" id="SelectOrganizationLink">
         Organizations
       </stripes:link>
    </td>
    <td width="10"></td>
    <td align="center">
      <stripes:link href="/selectCollaboration.jsp" id="SelectCollaborationLink">
        Collaborations
      </stripes:link>
    </td>
    <td width="10"></td>
    <td align="center">
       <stripes:link href="/reportDataIntegrity.jsp" id="ReportDataIntegrityLink">
         Data Semantic Check
       </stripes:link>
    </td>
  </tr>  
</table>
  
<hr align="left" width="900">
  <stripes:form id="EditCollaborationForm" action="/EditCollaboration.action" focus="">
  <table>
    <tr>
      <td>List of ISERN Collaborations:</td>
      <td width = "500"></td>
      <td>XML Data Import-Export</td>
      <td></td>
    </tr>
    <tr>
      <td>
        <stripes:link href="EditCollaboration.action" event="preEdit" id="NewCollaborationLink">
          New Collaboration
          <stripes:param name="name" value="${row.name}"/>
        </stripes:link>
      </td>
      <td></td>
      <td><stripes:text name="importFile"/></td>
      <td><stripes:submit name="importData" value="Import"/></td>
    </tr>
    <tr>
      <td>
        <stripes:link href="EditCollaboration.action" event="clearData"  id="ClearCollaborationLink">
          Clear All Collaborations
        </stripes:link>
      </td>
      <td></td>
      <td><stripes:text name="exportFile"/></td>
      <td><stripes:submit name="exportData" value="Export"/></td>
    </tr>
   </stripes:form>
  
  <table border="1" id = "SelectCollaborationTable">
  <tr>
     <th>Name</th>
     <th>Organizations</th>
     <th>Years</th>
     <th>Description</th>
     <th>Actions</th>
   </tr>
  
    <jsp:useBean id="reporter" scope="page" class="edu.hawaii.myisern.action.ReportActionBean"/>
    <c:forEach items="${reporter.collaborationTable}" var="row">
     <tr height=50>
      <td width = 200>
        <stripes:link href="EditCollaboration.action" event="preEdit" id="${row.name}">
          ${row.name}
          <stripes:param name="name" value="${row.name}"/>
        </stripes:link> 
      </td>
      <td width = 300>
        <c:forEach items="${row.organizations}" var="org">
          <stripes:link href="EditOrganization.action" event="preEdit" id="${org}">
            ${org}
            <stripes:param name="name" value="${org}"/>
          </stripes:link>
          <br/>
        </c:forEach> 
      </td>
      <td>
        <c:forEach items="${row.years}" var="year">
          ${year}
          <br/>
        </c:forEach> 
      </td>
      <td width = 400>
        ${row.description}
        <c:if test="${empty row.description}">
          Description not available.
        </c:if>    
        
      </td>
      <td>
        <stripes:link href="EditCollaboration.action" event="preEdit" id="${row.name}">
          Edit
          <stripes:param name="name" value="${row.name}"/>
        </stripes:link>
        <br/>
        <stripes:link href="EditCollaboration.action" event="delete" id="${row.name}">
          Delete
          <stripes:param name="name" value="${row.name}"/>
        </stripes:link> 
      </td>       
    </tr>
    </c:forEach>
</table>
 
</body>
</html>
